package com.dfbz.demo01;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01_Math的基本用法 {
    public static void main(String[] args) {

        System.out.println(Math.abs(100));          // 100
        System.out.println(Math.abs(-100));         // 100

        System.out.println("------------");

        System.out.println(Math.ceil(125.3));           // 126.0
        System.out.println(Math.ceil(125.8));           // 126.0
        System.out.println(Math.ceil(125.49));           // 126.0

        System.out.println("------------");
        System.out.println(Math.floor(125.9));           // 125.0
        System.out.println(Math.floor(125.1));           // 125.0
        System.out.println(Math.floor(125.19));           // 125.0

        System.out.println("------------");

        System.out.println(Math.round(125.5));           // 126
        System.out.println(Math.round(125.2));           // 125

        System.out.println("-------------");

        for (int i = 0; i < 1000; i++) {
            // 0~1
            System.out.println(Math.random());
        }
    }
}
